// https://nuxt.com/docs/api/configuration/nuxt-config
import AutoImport from 'unplugin-auto-import/vite';
import Components from 'unplugin-vue-components/vite';
import { NaiveUiResolver } from 'unplugin-vue-components/resolvers';
export default defineNuxtConfig({
    devtools: { enabled: false },
    // 是否开启 ssr 服务端渲染
    ssr: true,

    nitro: {
        devProxy: {
            "/api": {
                target: "https://mock.apifox.com/m1/1810143-0-default", // 这里是接口地址
                changeOrigin: true,
                prependPath: true,
            },
        },
    },
    modules: ['@unocss/nuxt'],
    css: ['~/assets/css/reset.css'],

    build: {
        transpile:
            process.env.NODE_ENV === 'production' ? ['naive-ui', 'vueuc', '@css-render/vue3-ssr', 'juggle/resize-observer'] : ['@juggle/resize-observer'],
    },
    vite: {
        optimizeDeps: {
            include: process.env.NODE_ENV === 'development' ? ['naive-ui', 'vueuc', 'date-fns-tz/esm/formatInTimeZone'] : [],
        },
        plugins: [
            AutoImport({
                imports: [
                    {
                        'naive-ui': ['useDialog', 'useMessage', 'useNotification', 'useLoadingBar'],
                    },
                ],
            }),
            Components({
                resolvers: [NaiveUiResolver()]
            })
        ]
    }
})
